package org.ejc.registration;


import java.io.IOException;

import javax.ejb.CreateException;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.ejc.api.registration.RegistrationAPIUtil;


/**
 * @author zac
 *
 * @web.servlet name = "RegisterServlet"
 * 		description = "Register a dude" 
 * 		display-name = "RegisterServlet"
 * 
 * @web.servlet-mapping url-pattern = "/register"
 * 
 * Log an event to the database
 */
public class RegisterServlet  extends HttpServlet {


	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		System.out.println("Hello from ejc Web Side :)");
		System.out.println("About to call zacreateReg now .....");
		try {
			RegistrationAPIUtil.getHome().create().createReg();
		} catch (CreateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		response.getWriter().println("Success --->");
		
		
		
	}




}